<?php

namespace TableTennis\ClubBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Validator\ErrorElement;
use Sonata\AdminBundle\Form\FormMapper;

class ClubAdmin extends Admin
{
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            ->with('Contenu')
                ->add('name', null, array('label' => 'Nom'))
                ->add('club_number', null, array('label' => 'N° Club'))
                ->add('website', null, array('label' => 'Site web'))
            ->end()
            ->with('Options')
              ->add('city_id', null, array('label' => 'Ville du club'))
            ->end()

        ;
    }

    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper
            ->add('name')
        ;
    }

    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('name')
            ->add('club_number')
        ;
    }

    /*public function validate(ErrorElement $errorElement, $object)
    {

    }*/
}

?>